import axios from '@/libs/api.request'

export const getSysFileInfo = (id) => {
  return axios.request({
    url: 'sys/download/info/' + id,
    method: 'get'
  })
}

export const deleteFile = (id) => {
  return axios.request({
    url: 'sys/download/delete',
    method: 'post',
    data: id
  })
}

export const saveOrUpdateSysFile = (formItem) => {
  let path = ''
  if (typeof (formItem.uuid) === 'undefined') {
    path = 'sys/download/save'
  } else {
    path = 'sys/download/update'
  }
  return axios.request({
    url: path,
    method: 'post',
    data: formItem
  })
}

export const listAllFile = () => {
  return axios.request({
    url: 'sys/download/all',
    method: 'get'
  })
}
